<?php
include_once '../config/server_config.php';
include_once $DOCUMENT_ROOT.'/include/mysql_query_focus.php';



$query="select louba_id from louba_info where active='1' and is_close='2'";
$louba_list = DB::loadSlaveExecutor(DB_LOUBA)->query($query);

echo $louba_list['louba_id'];exit;


foreach($louba_list as $key){


         $louba_id=$louba_list['louba_id'];
	     $posts_click_tbl=get_posts_click_tbl($louba_id);

		$query1="select * from $posts_click_tbl where  louba_id= $louba_id  order by click_num desc limit 10";
		$res1 = DB::loadSlaveExecutor(DB_LOUBA_COUNT)->querys($query);


		$msg_id		= $res1['msg_id'];
		$click_nums		= $res1['click_nums'];
		$time=time();


		$posts_main_tbl=get_posts_main_tbl($louba_id);
		$query2="select title from $posts_main_tbl where msg_id=$msg_id";
		$res2 = DB::loadSlaveExecutor(DB_LOUBA_COUNT)->query($query);

		$title		= $res2['title'];

		$arrInsert['louba_id']			= $louba_id;
		$arrInsert['msg_id']			= $msg_id;
		$arrInsert['click_nums']			= $click_nums;
		$arrInsert['time']			= $time;
		$arrInsert['title']			= $title;


		$query3="insert  into posts_sort  ('louba_id','msg_id','title','click_nums','time') values ('".$arrInsert['louba_id']."','".$arrInsert['msg_id']."','".$arrInsert['title']."','".$arrInsert['click_nums']."','".$arrInsert['time']."',)";

		DB::loadExecutor(DB_LOUBA)->execute($query3);
			 


}




?>